Problem/Motivation

It is impossible to use AJAX on the condition configuration form due to the way the add condition form is rendered by ManageConditions::add(). The form is rendered on a route where it doesn't exist and then displayed in a modal. It's also the reason why the form action has to be overwritten by the same method.

Steps to reproduce

  • Install Entity Field Condition module from this MR or any other condition plugin with AJAX.
  • Try to add this type of condition to any list.
  • Trigger AJAX on the condition form. It does nothing.

Proposed resolution

In order for AJAX to work, the module has to make a sub-request to the form route. This way the form is rendered on a route where it exists and AJAX requests work as expected.

Remaining tasks

No.

User interface changes

No.

API changes

  • \Drupal\ctools\Form\ManageConditions::getConditionClass() is deleted, as it's not necessary anymore.

Data model changes

No.

Issue fork ctools-3230847

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Dmitriy.trt created an issue. See original summary.

dmitriy.trt’s picture

Issue summary: View changes
Status: Active » Needs review

Created MR !6. Patch/MR for Page Manager is also coming soon, as it requires changes too in order for this issue to be fixed.

dmitriy.trt’s picture

dmitriy.trt’s picture

StatusFileSize
new4.29 KB

Adding a patch file here for a stable reference from composer files. It was made from MR!6 at commit fce48234.

liquidcms’s picture

This applies to ctools 3.7, but does not apply to the latest version of ctools 3.8

hamrant’s picture

StatusFileSize
new4.21 KB

Re-roll for 3.x branch

ygstnd’s picture

StatusFileSize
new4.21 KB

Re-rolled #7 patch to make it compatible with Drupal 10

pavel ruban made their first commit to this issue’s fork.

pavel ruban’s picture

patch for 4.1.0 with additional fix: https://git.drupalcode.org/project/ctools/-/merge_requests/79/diffs?comm...

* Issue #3230847: On any complex widgets like media library which use sub dialog modal was the error which leaded to initial dialogue overwrite & complete data loss following by dialogue close, prevent this by render initial widget form in off canvas sidebar which allows to use secondary dialog modal.